// const { defineConfig } = require("@vue/cli-service");
const port = process.env.port || process.env.npm_config_port || 80; // 端口
const name = process.env.VUE_APP_TITLE || "薪管家钟房"; // 网页标题

const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  transpileDependencies: true,
  devServer: {
    client: {
      overlay: false, // 编译错误时，取消全屏覆盖（建议关掉）
    },
    host: "0.0.0.0",
    port: port,
    open: false,
    proxy: {
      "/api": {
        target: process.env.VUE_APP_BASE_API,
        changeOrigin: true,
        pathRewrite: {
          "^/api": "",
        },
      },
    },
  },
  configureWebpack: {
    name: name,
    resolve: {
      alias: {
        "@": resolve("src"),
      },
    },
  },
};
